From 100ac1a3762915042ee65b1bf370399966f61be5 Mon Sep 17 00:00:00 2001
From: Petri Hintukainen <phintuka@gmail.com>
Date: Fri, 11 Mar 2016 12:07:03 +0200
Subject: [PATCH 3/5] Check for empty strings

---
 src/libdvdcss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 408ec2f..ac90030 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -234,7 +234,7 @@ static int set_cache_directory( dvdcss_t dvdcss )
 
         /* Try looking in password file for home dir. */
         p_pwd = getpwuid(getuid());
-        if( p_pwd )
+        if( p_pwd && p_pwd[ 0 ] )
         {
             psz_home = p_pwd->pw_dir;
         }
@@ -248,7 +248,7 @@ static int set_cache_directory( dvdcss_t dvdcss )
         }
 
         /* Cache our keys in ${HOME}/.dvdcss/ */
-        if( psz_home )
+        if( psz_home && psz_home[ 0 ] )
         {
             int home_pos = 0;
 
-- 
2.10.0

